<include file="Remark:header"/>
<div class="wraper">
    <div class="top other">
        <p><a href="javascript:history.back();" class="iconfont icon-zuo fl-left"></a>杭州生活品质总点评</p>
    </div>
    <p class="tishi"><span class="iconfont icon-tishi"></span> 点击图片，选定后，确认提交</p>
    <div class="phenomenon clearfix marginb-50">
        <div class="title vote">每人最多投{BEESCRM:$num}个现象</div>
        <volist name="data" id="vo">
        <div class="list">
            <p class="number fl-left">{BEESCRM:$i}</p>
            <p>
                <span>年度现象</span>
                <span>{BEESCRM:$vo.title}</span>
            </p>
            <img src="{BEESCRM:$vo.picture}"/>
            <div class="cover" data-id="{BEESCRM:$vo.id}"><span class="iconfont icon-duigou duigou"></span></div>
        </div>
        </volist>
    </div>
    <div class="btn-box">
        <if condition="$voteState neq null"><a href="#" class="btn" style="width:100%">已投票</a><else/><a href="#" class="btn big-btn">确认提交</a></if>
    </div>
    <div class="popbox" id="vote-success">
        <div class="main">
            <p class="iconfont icon-duigou duigou"></p>
            <p class="vote-success">投票成功</p>
            <a href="#" class="btn-ok">确定</a>
        </div>
    </div>
</div>
<script src="/assets/activity/remark/js/jquery-2.1.0.min.js"></script>
<script>
    $(function(){
        $(window).load(function(){
            $('.pop-box1').hide();
        });
        $('.phenomenon').on('click','.list',function(){
        	var key=0;
        	var num={BEESCRM:$num};
        	$('.cover').each(function(){
        		var a=$(this).css('display');
        		if(a=='block'){
        			key=key+1;
        		}
        	});
        	if($(this).children('.cover').css('display')=='block'){
        		$(this).children('.cover').toggle();
        	}else{
        		if(key>=num){
            		infotips('最多只能投'+num+'票',$('.submit_tips'));
            	}else{
            		$(this).children('.cover').toggle();
            	}
        	}
        });
        $('.big-btn').click(function(){
        	var b=0;
        	$('.cover').each(function(){
        		var a=$(this).css('display');
        		if(a=='block'){
        			var c=$(this).data('id');
        			b=b+','+c;
        		}
        	});
        	if(b==0){
        		infotips('请选项现象',$('.submit_tips'));
        	}else{
        		$.ajax({
					type:'post',
					dataType:'json',
					data:{'id':b},
					url:"{BEESCRM::U('/Activity/Remark/ajaxVote',array('act_id'=>$act_id,'wechat_id'=>$wechat_id))}",
					success:function(data){
			        	 if(data.status == 'S'){
			        		 $('#vote-success').show();
			        	 }else{
			 				infotips('通讯错误',$('.submit_tips'));
			 			}
					},
					error:function(){
						infotips('通讯错误',$('.submit_tips')); 
					},
				});
        	}
        });
        $('.btn-ok').click(function(){
            $('#vote-success').hide();
            setTimeout('window.location.reload()',2000);
        })
    })
</script>
</body>

</html>
